#include <bits/stdc++.h>
#define int long long
using namespace std;
int n = 1,cnt,a,b,ans;
int col[10][10],col_[10],p[10];
inline bool ok()
{
    for(int i = 1;i<=n;i++)
        if(col_[i]!=col_[p[i]]) return 1;
    for(int i = 1;i<=n;i++)
        for(int j = 1;j<=n;j++)
            if(col[p[i]][p[j]]!=col[i][j]) return 1;
    return 0;
}
inline void get()
{
    for(int i = 1;i<n;i++)
    {
        for(int j = 1;j<=n;j++)
            p[j] = (i+j-1)%n+1;
        if(!ok()) return;
    }
    if(n==3)
    {
        for(int i = 1;i<=n;i++)
            p[i] = i;
        for(int i = 1;i<=n;i++)
        {
            swap(p[i],p[i%n+1]);
            if(!ok()) return;
            swap(p[i],p[i%n+1]);
        }
    }
    else
    {
        p[1] = 4,p[2] = 3,p[3] = 2,p[4] = 1;
        if(!ok()) return;
        p[1] = 2,p[2] = 1,p[3] = 4,p[4] = 3;
        if(!ok()) return;
        p[1] = 1,p[2] = 4,p[3] = 3,p[4] = 2;
        if(!ok()) return;
        p[1] = 3,p[2] = 2,p[3] = 1,p[4] = 4;
        if(!ok()) return;
    }
    // cout<<'\n';
    // for(int i = 1;i<=n;i++)
    //     cout<<col_[i]<<' ';
    // cout<<"\n";
    // for(int i = 1;i<=n;i++,cout<<'\n')
    //     for(int j = 1;j<=n;j++)
    //         cout<<col[i][j]<<' ';
    ans++;
}
void dfs(int x,int y)
{
    if(y>=x)
    {
        if(x==n) return get();
        for(int i = 1;i<=min(a,n);i++) col_[x+1] = i,dfs(x+1,1);
        return;
    }
    for(int i = 1;i<=min(b,n*(n-1)/2);i++) col[y][x] = col[x][y] = i,dfs(x,y+1);
}
const int mod = 998244353;
inline int qpow(int x,int y)
{
    int res = 1;
    while(y)
    {
        if(y&1) res = 1ll*res*x%mod;
        y>>=1;
        x = 1ll*x*x%mod;
    }
    return res;
}
inline int c(int x,int y)
{
    if(x<y) return 0;
    int res = 1;
    for(int i = x;i>x-y;i--)
        res = 1ll*res*i%mod;
    for(int i = 1;i<=y;i++)
        res = 1ll*res*qpow(i,mod-2)%mod;
    return res;
}
signed main()
{
    freopen("clown.in","r",stdin);
    freopen("clown.out","w",stdout);
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>cnt;int x;
    while(cnt--) cin>>x,n*=x;
    cin>>a>>b;
    dfs(0,0);
    if(a>n) ans = 1ll*ans*c(a,n);
    if(b>n*(n-1)/2) ans = 1ll*ans*c(b,n*(n-1)/2);
    cout<<ans;
    return 0;
}